#!/bin/bash
apt install -y gcc autoconf libtool automake make zlib1g-dev openssl asciidoc xmlto git-core net-tools
apt install -y libpcre3-dev
apt install -y libffi-dev libevent-dev
# install proxychains4
git clone https://github.com/rofl0r/proxychains-ng.git proxychains-ng
cd proxychains-ng
./configure
make -j4
make install
make install-config
cd ..
rm -Rf proxychains-ng
cat /dev/null > /usr/local/etc/proxychains.conf
cat > /usr/local/etc/proxychains.conf <<-EOF
strict_chain
proxy_dns 
remote_dns_subnet 224
tcp_read_time_out 15000
tcp_connect_time_out 8000
localnet 127.0.0.0/255.0.0.0
#quiet_mode

[ProxyList]
#socks5  127.0.0.1 1080
# local-net
socks5  10.0.0.2 1080
EOF

proxychains4 curl -SL -o zulu8.tar.gz https://cdn.azul.com/zulu-embedded/bin/zulu8.40.0.178-ca-jdk1.8.0_222-linux_aarch64.tar.gz
tar -zvxf zulu8.tar.gz
mv zulu8.40.0.178-ca-jdk1.8.0_222-linux_aarch64 /usr/local/zulu8
rm -Rf zulu8.tar.gz
cat >> /etc/profile <<-EOF
export JAVA_HOME=/usr/local/zulu8
export PATH=\$JAVA_HOME/bin:\$PATH

EOF

proxychains4 curl -SL -o go.tar.gz https://dl.google.com/go/go1.12.8.linux-arm64.tar.gz
tar -xvf go.tar.gz
mv go /usr/local
rm -Rf go.tar.gz
cat >> /etc/profile <<-EOF
export GOROOT=/usr/local/go
export GOPATH=\$HOME/go
export PATH=\$GOPATH/bin:\$GOROOT/bin:\$PATH

EOF

apt install -y gnupg ca-certificates
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb https://download.mono-project.com/repo/ubuntu stable-bionic main" | tee /etc/apt/sources.list.d/mono-official-stable.list
apt update
proxychains4 apt install -y mono-devel nuget

add-apt-repository ppa:deadsnakes/ppa
apt update
apt install -y python3.5-dev libhdf5-dev libhdf5-serial-dev
proxychains4 curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
proxychains4 python3.5 get-pip.py
rm get-pip.py

proxychains4 wget https://github.com/lhelontra/tensorflow-on-arm/releases/download/v1.14.0/tensorflow-1.14.0-cp35-none-linux_aarch64.whl
proxychains4 pip3.5 install tensorflow-1.14.0-cp35-none-linux_aarch64.whl
rm tensorflow-1.14.0-cp35-none-linux_aarch64.whl

pip3.5 install numpy==1.16.4
pip3.5 install pyyaml flask flask_bcrypt flask_login flask_wtf flask_socketio flask_cors flask_script flask_mongoengine